<!DOCTYPE html>
<html lang="en">

<head>
        {ms:include filename=headFile.htm/} 
</head>

<body class="white">
    <div id="appCtrl" v-locak>
        <mt-header title="登录">
            <a href="javascript:;" @click="history.go(-1)" slot="left">
                <mt-button icon="back"></mt-button>
            </a>
        </mt-header>
        <div class="form-login">
            <div class="login-logo"></div>

            <mt-field 
            placeholder="请输入手机号码/姓名" 
            v-model="username"><i slot="icon" class="login-icon"></i></mt-field>

            <mt-field 
            placeholder="请输入6~20位之间的密码"
            type="password" v-model="psw"><i slot="icon" class="login-icon login-psw"></i></mt-field>

            <div style="padding:15px">
                <mt-button size="large" type="primary" @click.native="submit">登 录</mt-button>
                <p class="forget clearfix">
                    <a href="{ms:global.url/}/185/index.html" class="cGray left">忘记密码</a>
                    <a  href="{ms:global.url/}/182/index.html" class="cGold right">立即注册</a>
                </p>
            </div>
        </div>
    </div>
    <script>
    var vm = new Vue({
        el: '#appCtrl',

        data: function(){
            return {
                username:'',
                psw:''
            }
        },

        methods:{
            submit: function(){
                if(!this.username){
                    this.$toast('请输入手机号码/姓名');
                    return;
                }
                if(!this.psw){
                    this.$toast('请输入登录密码');
                    return;
                }
                if(this.psw.length<6||this.psw.length>20){
                    this.$toast('6~20位之间的密码');
                    return;
                }
				
				
				$.ajax({
                        type: 'POST',
                        url:'http://test.51dfs.cn/kder-api/user/login.do',
                        data: {"clientType":"mobile","userName":vm.username,"password":vm.psw},
						dataType:'json',
                        success:function(res){
                            if(res.code==="0"){
                                location.href = 'http://test.51dfs.cn';
                            }else{
                                vm.$toast(res.msg);
                            }
                        }
                    })
                  //end ajax
				  
            }
        }
    })
    </script>
</body>

</html>